﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Win32;
using System.Timers;
using System.Windows.Threading;

namespace SpriteExtractor.View
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        DispatcherTimer timer = new DispatcherTimer();

        public MainWindow()
        {
            InitializeComponent();

            timer.Interval = new TimeSpan(2);
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
        }

        void timer_Tick(object sender, EventArgs e)
        {
            // mouse location
            Point pos = Mouse.GetPosition(imageMarker);
            positionBlock.Text = new Point(Math.Round(pos.X, 0), Math.Round(pos.Y, 0)).ToString();

            // sprite info
            spriteInfo.Text = imageMarker.ActiveSprite == null ? "" : ("" + imageMarker.ActiveSprite.DataContext);
        }

        ~MainWindow()
        {
            timer.Stop();
        }
    }
}
